﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="MovieList.aspx.cs" Inherits="MyMovieCollection.Views.Product.MovieList" %>
<%@ Import Namespace="MyMovieCollection.DATA.Models"%>
<%@ Import Namespace="System.Collections.Generic"%>
<%@ Import Namespace="MyMovieCollection.Controllers"%>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

    <script>
function SendSelectedMovieType(sender)
{
    var value=document.getElementById(sender).value;
    window.location.href="/Product/MovieList/"+ value;
}
function SortAction(actionName)
{
    var value=document.getElementById("Movie_Type").value;
    window.location.href="/Product/"+actionName+"/"+ value;
}
function OpenBigPoster(poster,movieName)
{
    window.open("/Product/ShowBig/"+poster+"/"+movieName,null,'height=1,width=1,scroll=no,toolbar=no,statusbar=no,addressbar=no,titlebar=no,TOOLBAR=no,menubar=no');
}
function ShowClicked(clickedValue)
{
    alert(clickedValue);
}
</script>
 <h2><%= Html.Encode(ViewData["Message"]) %></h2>
<table width="100%">
<tr>
<td width="25%"><strong><a href="javascript:SortAction('SortByMovieName')" >ADI</a></strong></td>
<td width="10%"><strong>YILI</strong></td>
<td width="10%"><strong><a href="javascript:SortAction('SortByPoint')" >PUANI</a></strong></td>
<td width="20%" ><strong>KATEGOR&#304;  <%= Html.DropDownList("Movie_Type", new { onchange = "SendSelectedMovieType('Movie_Type')" })%></strong></td>
<td width="35%" align="center"><strong>AFİŞ</strong></td>

</tr>
<%
    foreach(Movie movie in ((List<Movie>) ViewData["Movies"]))
    {
        %>
        <tr>
            <td width="25%" onclick="ShowClicked('<%=movie.Name %>');"><%=movie.Name %></td>
            <td width="15%"><%=movie.Year %></td> 
            <td width="15%"><%=movie.Point %></td> 
            <td width="20%"><%=movie.Movie_Type.TypeName%></td> 
            <td width="20%"><a href="/Product/Delete/<%=movie.ID%>">Sil</a></td>             
            <td width="35%" align="center"><img width="100" height="100" title="<%=movie.Name%>" src="../../Content/Upload/<%=movie.Poster%>" onclick="OpenBigPoster('<%=movie.Poster%>','<%=movie.Name%>');" onmouseover="this.style.cursor='hand';" /></td>
        </tr>
        <%
        
    }
     %>
  <tr>
  <td colspan="2" ></td>
  <td align="center"><a href="/Product/Delete/Index">Yeni Kayıt</a></td>
  <td align="center"><a href="/Product/Delete/Search">Arama</a> </td>
  </tr>
</table>
</asp:Content>
